//
//  ViewController.m
//  UISwitch
//
//  Created by clz on 2019/8/6.
//  Copyright © 2019年 clz. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UISwitch *mySwitch = [[UISwitch alloc]init];
    //内置控件的大小
    mySwitch.on = YES;
    mySwitch.tintColor = [UIColor redColor];//关闭状态的边框颜色
    mySwitch.onTintColor = [UIColor yellowColor];
    mySwitch.thumbTintColor = [UIColor blueColor];
    [self.view addSubview:mySwitch];
    mySwitch.frame = CGRectMake(100, 100, 300, 300);
    
    [mySwitch addTarget:self action:@selector(click) forControlEvents:UIControlEventValueChanged];
    
}

- (void)click{
    NSLog(@"触发");
}

@end
